package core

import (
	"jslog/router"
	"jslog/system/middleware"

	"github.com/gin-contrib/sessions"
	"github.com/gin-contrib/sessions/cookie"
	"github.com/gin-gonic/gin"
)

func Engine() {

	eng := gin.Default()
	eng.Use(middleware.Cors())
	router.NoVerifyRouter(eng)
	router.VerifyRouter(eng)
	router.VerifyAdminRouter(eng)
	router.VerifyApiRouter(eng)
	router.VerifyPcApiRouter(eng)

	var store cookie.Store = cookie.NewStore([]byte("jslog689"))
	store.Options(sessions.Options{MaxAge: 86400, Path: "/"})
	eng.Use(sessions.Sessions("sessionid", store))

	go eng.Run(":8080")
	go eng.Run(":8081")
	eng.Run(":16969")
}
